/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.manchester.biology.eqhei.persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author mlwyatt
 */
@Embeddable
public class AttributeSetPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "attributeSetName")
    private String attributeSetName;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "attributeName")
    private String attributeName;

    public AttributeSetPK() {
    }

    public AttributeSetPK(String attributeSetName, String attributeName) {
        this.attributeSetName = attributeSetName;
        this.attributeName = attributeName;
    }

    public String getAttributeSetName() {
        return attributeSetName;
    }

    public void setAttributeSetName(String attributeSetName) {
        this.attributeSetName = attributeSetName;
    }

    public String getAttributeName() {
        return attributeName;
    }

    public void setAttributeName(String attributeName) {
        this.attributeName = attributeName;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (attributeSetName != null ? attributeSetName.hashCode() : 0);
        hash += (attributeName != null ? attributeName.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AttributeSetPK)) {
            return false;
        }
        AttributeSetPK other = (AttributeSetPK) object;
        if ((this.attributeSetName == null && other.attributeSetName != null) || (this.attributeSetName != null && !this.attributeSetName.equals(other.attributeSetName))) {
            return false;
        }
        if ((this.attributeName == null && other.attributeName != null) || (this.attributeName != null && !this.attributeName.equals(other.attributeName))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.manchester.biology.eqhei.business.AttributeSetPK[ attributeSetName=" + attributeSetName + ", attributeName=" + attributeName + " ]";
    }
    
}
